package com.timeriver.domain.enums;

import lombok.Getter;

/**
 * 模型文件是否被使用过
 */
@Getter
public enum StatusCategory {

    NOTUSE(0, "未使用"),
    INUSE(1, "使用中"),
    UNDEIFINE(2, "未定义");

    private int status;
    private String name;

    StatusCategory(int status, String name) {
        this.status = status;
        this.name = name;
    }

    public static String getName(int status) {
        StatusCategory[] values = StatusCategory.values();
        for (StatusCategory value : values) {
            if (value.status == status) {
                return value.name;
            }
        }
        return StatusCategory.UNDEIFINE.name;
    }

    public static int getStatus(String name) {
        StatusCategory[] values = StatusCategory.values();
        for (StatusCategory value : values) {
            if (value.name == name) {
                return value.status;
            }
        }
        return StatusCategory.UNDEIFINE.status;
    }
}
